package com.guoguo.oauth2.server.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * 客户端配置类
 */
@Component
@ConfigurationProperties(prefix = "client.oauth2")
public class ClientOAuth2DataConfiguration {

    // 客户端标识 ID
    private String clientId;

    // 客户端安全码
    private String secret;

    // 授权类型
    private String[] grantTypes;

    // token有效期
    private int tokenValidityTime;

    // refresh-token有效期
    private int refreshTokenValidityTime;

    // 客户端访问范围
    private String[] scopes;

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public String[] getGrantTypes() {
        return grantTypes;
    }

    public void setGrantTypes(String[] grantTypes) {
        this.grantTypes = grantTypes;
    }

    public int getTokenValidityTime() {
        return tokenValidityTime;
    }

    public void setTokenValidityTime(int tokenValidityTime) {
        this.tokenValidityTime = tokenValidityTime;
    }

    public int getRefreshTokenValidityTime() {
        return refreshTokenValidityTime;
    }

    public void setRefreshTokenValidityTime(int refreshTokenValidityTime) {
        this.refreshTokenValidityTime = refreshTokenValidityTime;
    }

    public String[] getScopes() {
        return scopes;
    }

    public void setScopes(String[] scopes) {
        this.scopes = scopes;
    }

    @Override
    public String toString() {
        return "ClientOAuth2DataConfiguration{" +
                "clientId='" + clientId + '\'' +
                ", secret='" + secret + '\'' +
                ", grantTypes=" + Arrays.toString(grantTypes) +
                ", tokenValidityTime=" + tokenValidityTime +
                ", refreshTokenValidityTime=" + refreshTokenValidityTime +
                ", scopes=" + Arrays.toString(scopes) +
                '}';
    }
}